import RPi.GPIO as GPIO
import time
from adafruit_servokit import ServoKit

channel = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel,GPIO.IN)
def callback(channel):
    info = GPIO.input(channel)
    if info:
        print("no sound")
        print(GPIO.input(channel))
    else:
        print("sound is ok,volt:{}".format(info))

GPIO.add_event_detect(channel,GPIO.BOTH,bouncetime=300)
GPIO.add_event_callback(channel,callback)

while True:
   time.sleep(1)

